package wodegua.d2_demo;

import java.util.Scanner;

public class Scoring {
    public static void main(String[] args) {
        System.out.println(getScore(7));
    }

    public static double getScore(int number){
        int[] scores = new int[number];

        Scanner scanner = new Scanner(System.in);
        for (int i = 0; i < number; i++) {
            System.out.println("输入分数：");
            int score = scanner.nextInt();
            scores[i] = score;
        }

        int max = scores[0];
        int min = scores[0];
        int sum = 0;
        for (int i = 0; i < scores.length; i++) {
            sum += scores[i];
            if (max < scores[i]) {
                max = scores[i];
            }
            if (min > scores[i]) {
                min = scores[i];
            }
        }
        return 1.0 * (sum - max - min) / (number - 2);
    }
}
